package com.appspot.MercerBroker;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;

public class ServeStrOutStream extends ServletOutputStream
{

	private final ByteArrayOutputStream _dataBytes = 
			new ByteArrayOutputStream();

	@Override
	public void write(int i) throws IOException 
	{
		_dataBytes.write(i);

	}//method

	public byte[] getBytes()
	{  
		return _dataBytes.toByteArray();

	}//method

	public String getString()
	{  
		return new String( getBytes() );

	}//method

	@Override
	public boolean isReady()
	{
		return true;

	}//method

	@Override
	public void setWriteListener(WriteListener arg0)
	{
		throw new RuntimeException( "not implemented: setWriteListener" );

	}//method


}//class

